package com.free.system.api.factory;

import com.huaweicloud.sdk.image.v2.model.ImageTaggingItemBody;
import com.huaweicloud.sdk.image.v2.model.ImageTaggingReq;
import com.free.common.core.web.domain.R;
import com.free.system.api.RemoteRecognitionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 *
 * @author free
 */
@Component
public class RemoteRecognitionFallbackFactory implements FallbackFactory<RemoteRecognitionService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteRecognitionService.class);

    @Override
    public RemoteRecognitionService create(Throwable throwable) {
        log.error("用户服务调用失败:{}" , throwable.getMessage());
        return new RemoteRecognitionService() {

            /**
             * 图片的ai识别能力
             *
             * @param body
             * @return
             */
            @Override
            public R<List<ImageTaggingItemBody>> recognitionImages(ImageTaggingReq body) {
                return null;
            }

            @Override
            public R<String> xfAudioUpload(String body) {
                return null;
            }

            @Override
            public R<String> xfAudioGetContent(String body) {
                return null;
            }

            @Override
            public R<String> baiduCreate(String body) {
                return null;
            }

            @Override
            public R<String> baiduAudioGetContent(String body) {
                return null;
            }
        };
    }
}
